﻿<cfsilent>
	<cfscript>
		
		mathAdvice = getProperty("serviceFactory").getBean("senateMathAdvice");
		
		termId = event.getArg("TermID");
		academicYear = event.getArg("AcademicYear");
		academicTerm = event.getArg("AcademicTerm");
		termDateStart = event.getArg("DateStart");
		
		taskId = event.getArg("TSK");
		taskType = event.getArg("TT");
		
		passArgs = structNew();
		structInsert( passArgs, "TSK", taskId );
		structInsert( passArgs, "TT", taskType );
		structInsert( passArgs, "TID", termId );
		
		switch(taskType){
			case "C":
				sql = "SELECT 
							t_course.course_name, 
							a.task_week, 
							t_teacher.tch_name, 
							t_institute.institute_name, 
							t_course.period, 
							t_course.period_theory, 
							t_course.course_credit, 
							t_teacher.tch_id, 
							a.task_period, 
							a.task_desc, 
							t_campus.campus_name, 
							t_classroom_type.cr_type_name, 
							a.task_chooesd, 
							a.task_limite 
						FROM 
							t_common_task a 
							INNER JOIN t_course ON t_course.cid = a.cid 
							INNER JOIN t_institute ON t_institute.institute_id = t_course.institute_id 
							INNER JOIN t_teacher ON t_teacher.tch_id = a.tch_id 
							INNER JOIN t_campus ON t_campus.campus_id = a.campus_id 
							INNER JOIN t_classroom_type ON t_classroom_type.cr_type = a.cr_type 
						WHERE 
							a.tsk_id = :taskId ";
				break;

			case "P":
				sql = "SELECT 
							t_course.course_name, 
							a.task_week, 
							t_teacher.tch_name, 
							t_institute.institute_name, 
							t_course.period, 
							t_course.period_theory, 
							t_course.course_credit, 
							t_teacher.tch_id, 
							a.task_period, 
							a.task_desc, 
							t_campus.campus_name, 
							t_classroom_type.cr_type_name, 
							a.task_chooesd, 
							a.task_limite, 
							a.task_classes 
						FROM 
							t_task a 
							INNER JOIN t_course ON t_course.cid = a.cid 
							INNER JOIN t_institute ON t_institute.institute_id = t_course.institute_id 
							INNER JOIN t_teacher ON t_teacher.tch_id = a.tch_id 
							INNER JOIN t_campus ON t_campus.campus_id = a.campus_id 
							INNER JOIN t_classroom_type ON t_classroom_type.cr_type = a.cr_type 
						WHERE 
							a.tsk_id = :taskId ";
				break;
			
			case "R":
				sql = "SELECT 
							t_course.course_name, 
							a.task_week, 
							t_teacher.tch_name, 
							t_institute.institute_name, 
							t_course.period, 
							t_course.period_theory, 
							t_course.course_credit, 
							t_teacher.tch_id, 
							a.task_period, 
							a.task_desc, 
							t_campus.campus_name, 
							t_classroom_type.cr_type_name, 
							a.task_chooesd, 
							a.task_limite  
						FROM 
							t_reopen_task a 
							INNER JOIN t_course ON t_course.cid = a.cid 
							INNER JOIN t_institute ON t_institute.institute_id = t_course.institute_id 
							INNER JOIN t_teacher ON t_teacher.tch_id = a.tch_id 
							INNER JOIN t_campus ON t_campus.campus_id = a.campus_id 
							INNER JOIN t_classroom_type ON t_classroom_type.cr_type = a.cr_type 
						WHERE 
							a.tsk_id = :taskId ";
				break;
			
			case "T":
				sql = "SELECT 
							t_course.course_name, 
							a.task_week, 
							t_teacher.tch_name, 
							t_institute.institute_name, 
							t_course.period, 
							t_course.period_theory, 
							t_course.course_credit, 
							t_teacher.tch_id, 
							a.task_period, 
							a.task_desc, 
							t_campus.campus_name, 
							t_classroom_type.cr_type_name, 
							a.task_chooesd, 
							a.task_limite 
						FROM 
							t_sport_task a 
							INNER JOIN t_course ON t_course.cid = a.cid 
							INNER JOIN t_institute ON t_institute.institute_id = t_course.institute_id 
							INNER JOIN t_teacher ON t_teacher.tch_id = a.tch_id 
							INNER JOIN t_campus ON t_campus.campus_id = a.campus_id 
							INNER JOIN t_classroom_type ON t_classroom_type.cr_type = a.cr_type 
						WHERE 
							a.tsk_id = :taskId ";
				break;
		}
		
		queryObj = new query( datasource=application.dnsSlave );
		queryObj.addParam( name="taskId", value=taskId, cfsqltype="cf_sql_varchar" );
		rs_task = queryObj.execute( sql=sql ).getResult();	
		
		event.setArg("pageTitle", "教学任务安排 - 临时更换教室 - " & rs_task.course_name );
		
		weekStart = listFirst( rs_task.task_week, "-" );
		weekEnd = listLast( rs_task.task_week, "-" );
		
		/* 计算当前教学周 */
		taskWeek = mathAdvice.convertTaskWeek(termDateStart, DateFormat(now(), "YYYYMMDD"));
		
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('taskTempChange')#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">临时调停课</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 card"></i>临时调换教室 <cfoutput>#rs_task.course_name#</cfoutput>-<cfoutput>#rs_task.tch_name#</cfoutput> 
				</h2>
			</div>
		</div>
	</div>
</div>

<!--- 加载导航菜单 --->
<!-- stepMenu-->
<cfoutput>#event.getArg("stepMenu")#</cfoutput>
<!--/stepMenu-->

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
			
				<div class="noticeBlock">
					<h3>《<cfoutput>#rs_task.course_name#</cfoutput>》 任课单位: <cfoutput>#rs_task.institute_name#</cfoutput></h3>
					<p><span class="img icon16x16 message"></span>总学时 <em><cfoutput>#rs_task.period#</cfoutput></em>, 其中理论学时 <em><cfoutput>#rs_task.period_theory#</cfoutput></em>. 课程总学分:<em><cfoutput>#numberFormat(rs_task.course_credit, '_.00')#</cfoutput></em> 主讲教师: <cfoutput>#rs_task.tch_name#</cfoutput><em>(<cfoutput>#rs_task.tch_id#</cfoutput>)</em> 排课周次: <em><cfoutput>#rs_task.task_week#</cfoutput></em> 周学时: <em><cfoutput>#rs_task.task_period#</cfoutput></em> </p>
					<cfif rs_task.task_desc neq "">
						<p><span class="img icon16x16 message"></span>排课要求: <cfoutput>#rs_task.task_desc#</cfoutput> </p>
					</cfif>
					<p><span class="img icon16x16 building"></span> 校区: <cfoutput>#rs_task.campus_name#</cfoutput> 教学场地: <cfoutput>#rs_task.cr_type_name#</cfoutput> 实际人数: <em><cfoutput>#rs_task.task_chooesd#</cfoutput></em> 计划人数: <em><cfoutput>#rs_task.task_limite#</cfoutput></em>
					<cfif taskType eq "P">
						<span class="img icon16x16 card"></span> 排课班级: <cfoutput>#rs_task.task_classes#</cfoutput>
					</cfif>
					</p>
					
					<hr/>
					
					<div class="UIArrangeOper mtl">
						
						<b class="lable">选择周次</b>
						<div class="content">
							
							<cfset weekCount = weekEnd - weekStart + 1 />
							<cfloop from="#weekStart#" to="#weekEnd#" index="w">
								<cfif taskWeek lte w and w gte taskWeek >
									<cfset structInsert( passArgs, "W", w, true ) />
									<a class="weekBtn" href="<cfoutput>#buildURL('taskChangeWizardPlaceLecture', passArgs)#</cfoutput>"><cfoutput>#w#</cfoutput></a>
									<cfelse>
									<span class="weekBtn"><cfoutput>#w#</cfoutput></span>
								</cfif>
							</cfloop>
							
						</div>
						
					</div>
					
				</div>
							
				
				
			</div>
		</li>
	</ul>
</div>
			
			